<?php 

$db = include ('./db.php');

if($_POST){
  $notice = true;
  $insertData = array();
  $insertData['username'] = $username =  $_POST['username'];
  $insertData['message'] =  $message = $_POST['message'];

  $str =<<<zhibin
<li class='list-group-item'><h4 class='list-group-itemheading'>$username</h4><p class='list-group-item-text'>$message</p><a href='./edit.php?id=' class='btn btn-sm btn-success'>修改</a><a href='./del.php?id=' class='btn btn-sm btn-danger'>删除</a></li>
zhibin;

	echo $str;


  if(!empty($insertData['username'])&&!empty($insertData['message'])){
      array_push($db, $insertData);

      $insertData = var_export($db,TRUE);

  $str = <<<str
<?php 
return {$insertData} ?>
str;
  
      file_put_contents('./db.php', $str);
      $error = false;
  }else{
      $error = true;
  }
}
















 ?>